﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.Sql;
using System.Data.SqlClient;
using System.Windows.Forms;
using Microsoft.SqlServer.Management.Smo;
using Microsoft.SqlServer.Management.Nmo;
using Microsoft.SqlServer.Management.Common;
using Microsoft.SqlServer.Management.Trace;
using Entity;
namespace DataControls
{
    public class HOCVI_Data
    {
        HOCVI hocvi = new HOCVI();
        DataBaseAccess dataBaseAccess = new DataBaseAccess();

        public void hocvi_Combobox(ComboBox cb)
        {
           String excuteString = "SELECT MAHOCVI, TENHOCVI FROM HOCVI" ;
           dataBaseAccess.addto_Combobox(cb, excuteString);
        }

        public Boolean kiemtraMaHV_GV(String mahocvi)
        {
            int i = 0;
            String excuteString = "SELECT COUNT(*) FROM GIAOVIEN WHERE MAHOCVI='" + mahocvi + "'";
            i = dataBaseAccess.Test(excuteString);
            if (i > 0)
                return true;
            else
                return false;
        }

        public Boolean kiemtra_MaHocVi(String mahocvi)
        {
            int i = 0;
            String excuteString ="SELECT COUNT(*) FROM HOCVI WHERE MAHOCVI='" + mahocvi + "'";
            i = dataBaseAccess.Test(excuteString);
            if (i > 0)
                return true;
            else 
                return false;
        }

        public Boolean kiemtra_TenHocVi(String tenhocvi)
        {
            int i = 0;
            String excuteString = "SELECT COUNT(*) FROM HOCVI WHERE TENHOCVI='" + tenhocvi + "'";
            i = dataBaseAccess.Test(excuteString);
            if (i > 0)
                return true;
            else 
                return false;
        }
    }





}
